import sys
if __name__ == "__main__":
    f = open(sys.argv[1])
    old_id = None
    rec_list = []
    for line in f:
        line = line.strip()
        parts = line.split()
        if old_id is None or parts[0] != old_id:
            if old_id is not None:
                rec_list = sorted(rec_list, key=lambda y:y[0], reverse = True)
                print old_id, " ".join([":".join(map(str,x)) for x in rec_list])
            old_id = parts[0]
            rec_list = []
        rec_list.append((int(parts[1]),int(parts[2])))
    print old_id, " ".join([":".join(map(str,x)) for x in rec_list])

    f.close()
        
